package cn.edu.hpu.web;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import cn.edu.hpu.dao.ContactNoteDao;
import cn.edu.hpu.entity.Employee;
import cn.edu.hpu.utitl.TimeUtitl;
import cn.edu.hpu.utitl.UUIDUtitl;

public class ContactNoteServlet extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		response.setContentType("text/html;charset=GBK");
		String cid = request.getParameter("cid");
		String cncontent = request.getParameter("cncontent");
		String cnid = UUIDUtitl.getUUID();
		String cnctime = TimeUtitl.getTime();
		HttpSession session = request.getSession();
		Employee e =(Employee) session.getAttribute("employee");
		String eid = e.getEid();
		ContactNoteDao cnd = new ContactNoteDao();
		cnd.insertContactNote(cid, cnid, cncontent, cnctime, eid);
		request.getRequestDispatcher("/WEB-INF/views/contact_note.jsp").forward(request, response);
	}

}
